import request from '@/utils/request'

// 查询工单管理列表
export function listPworkorder(query) {
  return request({
    url: '/prodplan/pworkorder/list',
    method: 'get',
    params: query
  })
}

// 查询工单管理详细
export function getPworkorder(workorderId) {
  return request({
    url: '/prodplan/pworkorder/' + workorderId,
    method: 'get'
  })
}

// 新增工单管理
export function addPworkorder(data) {
  return request({
    url: '/prodplan/pworkorder',
    method: 'post',
    data: data
  })
}

// 修改工单管理
export function updatePworkorder(data) {
  return request({
    url: '/prodplan/pworkorder',
    method: 'put',
    data: data
  })
}

// // 删除工单管理
// export function delPworkorder(prodorderNo) {
//   return request({
//     url: '/prodplan/pworkorder/'+prodorderNo,
//     method: 'delete'
//   })
// }

// 删除工单管理
export function delPworkorder(data) {
  return request({
    url: '/prodplan/pworkorder/',
    method: 'delete',
    data: data
  })
}

// 导出工单管理
export function exportPworkorder(query) {
  return request({
    url: '/prodplan/pworkorder/export',
    method: 'get',
    params: query
  })
}

// 计划确认
export function confirm(data) {
  return request({
    url: '/prodplan/pworkorder/confirm',
    method: 'post',
    data: data
  })
}

// 反计划确认
export function unConfirm(data) {
  return request({
    url: '/prodplan/pworkorder/unconfirm',
    method: 'post',
    data: data
  })
}

// 下达
export function issue(data) {
  return request({
    url: '/prodplan/pworkorder/issue',
    method: 'post',
    data: data
  })
}
// 反下达
export function unIssue(data) {
  return request({
    url: '/prodplan/pworkorder/unissue/',
    method: 'post',
    data: data
  })
}
// 开工
export function startup(workorderIds) {
  return request({
    url: '/prodplan/pworkorder/startup/'+workorderIds,
    method: 'post',
  })
}
// 反开工
export function unStartup(workorderIds) {
  return request({
    url: '/prodplan/pworkorder/unstartup/'+workorderIds,
    method: 'post',
  })
}

// 齐套
export function IsCompletion(data) {
  return request({
    url: '/prodplan/pworkorder/IsCompletion/',
    method: 'post',
    data: data
  })
}
// 挂起
export function hangup(data) {
  return request({
    url: '/prodplan/pworkorder/hangup/',
    method: 'post',
    data: data
  })
}
// 反挂起
export function hangdown(data) {
  return request({
    url: '/prodplan/pworkorder/hangdown/',
    method: 'post',
    data: data
  })
}
// 结案
export function closed(data) {
  return request({
    url: '/prodplan/pworkorder/closed/',
    method: 'post',
    data: data
  })
}
// 反结案
export function unclosed(data) {
  return request({
    url: '/prodplan/pworkorder/unclosed/',
    method: 'post',
    data: data
  })
}
// 完工
export function completion(workorderIds) {
  return request({
    url: '/prodplan/pworkorder/completion/'+ workorderIds,
    method: 'post',
  })
}

// 查询车间
export function listWorkShop() {
  return request({
    url: '/prodplan/pworkorder/listWorkShopName',
    method: 'get',
  })
}


// 查询订单编号
export function getOrderNum(query) {
  return request({
    url: '/prodplan/pworkorder/listOrderNum',
    method: 'get',
    params: query
  })
}
// 查询产品
export function getlistprod(query) {
  return request({
    url: '/prodplan/pworkorder/listprod',
    method: 'get',
    params: query
  })
}

// 按找产品编码查询
export function getlistprodbycond(query) {
  return request({
    url: '/prodplan/pworkorder/listprodbycond/'+query,
    method: 'get',
    
  })
}
// 查询产线
export function listLine(workshopName) {
    return request({
      url: '/prodplan/pworkorder/listline/'+workshopName,
      method: 'get',
      
    })
  }
